VMX: Always disable SMEP when guest is in non-paging mode
authorStefan Bader <stefan.bader@canonical.com>
Thu, 4 Apr 2013 08:37:19 +0000 (10:37 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 4 Apr 2013 08:37:19 +0000 (10:37 +0200)
commit0d2e673a763bc7c2ddf97fed074eb691d325ecc5
tree4681ebcaf7069b02ed66d0dc164c30563146ec64
parent41e71c2607e036f1ac00df898b8f4acb2d4df7ee
VMX: Always disable SMEP when guest is in non-paging mode

commit e7dda8ec9fc9020e4f53345cdbb18a2e82e54a65
  VMX: disable SMEP feature when guest is in non-paging mode

disabled the SMEP bit if a guest VCPU was using HAP and was not
in paging mode. However I could observe VCPUs getting stuck in
the trampoline after the following patch in the Linux kernel
changed the way CR4 gets set up:
  x86, realmode: read cr4 and EFER from kernel for 64-bit trampoline

The change will set CR4 from already set flags which includes the
SMEP bit. On bare metal this does not matter as the CPU is in non-
paging mode at that time. But Xen seems to use the emulated non-
paging mode regardless of HAP (I verified that on the guests I was
seeing the issue, HAP was not used).

Therefor it seems right to unset the SMEP bit for a VCPU that is
not in paging-mode, regardless of its HAP usage.

Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Keir Fraser <keir@xen.org>
Acked-by: Dongxiao Xu <dongxiao.xu@intel.com>
xen/arch/x86/hvm/vmx/vmx.c